#ifndef SDFDOFRANGE_H
#define SDFDOFRANGE_H

#include <osg/Node>
#include <osg/Vec3>
#include <vector>

#include <BulletLibDefine.h>
class BULLET_EDITOR_DLL Range1D
{
public:
    Range1D();
    virtual ~Range1D();
    Range1D operator&(Range1D &t);

    Range1D andOperatorAsAngle(Range1D & t);
    Range1D orOperatorAsAngle(Range1D & t1, Range1D & t2);//no using

    void twoRangeAsAngle(Range1D& t1, Range1D& t2);
    Range1D transRangeAsAngleNearZero();
    double min;
    double max;

    bool minClosed;
    bool maxClosed;
    bool isValid;
};

class BULLET_EDITOR_DLL SDFDofRange : public osg::Node
{
public:
    SDFDofRange();
    virtual ~SDFDofRange();

    SDFDofRange operator&(SDFDofRange &t);

    double getMinS();
    double getMaxS();
    double getMinT();
    double getMaxT();

    bool getMinSClosed();
    bool getMaxSClosed();
    bool getMinTClosed();
    bool getMaxTClosed();

    void computeRangeFromNormal(const osg::Vec3& normal);

    bool getIsValid();

    void print();
protected:
    double computeRangeSAngle(const osg::Vec3& normal);
    double computeRangeTAngle(const osg::Vec3& normal);

    void setIsValid(bool boolValue);
private:
    double m_minS;
    double m_minT;
    double m_maxS;
    double m_maxT;

    bool m_minSClosed;
    bool m_maxSClosed;
    bool m_minTClosed;
    bool m_maxTClosed;

    Range1D m_rangeS;
    Range1D m_rangeT;

    bool m_isValid;
};

#endif // SDFDOFRANGE_H
